<script type='text/javascript'>
    $(document).ready(function(){
//        $("#btn_pilih_NOP").click(function(){
//            $("#dialog-objek").dialog('open');
//        });
   
        $("#btn_pilih_NOP").click(function(){
            $("#dialog-objek").dialog('open');

    var	tmp_no_op  = $("#txt_no_op").val();


$.ajax({
	type: "POST",
    url: "<?php echo Yii::app()->createUrl('/PembayaranSetoranBank/Select'); ?>",
	dataType: "json",
	data: "no_op="+tmp_no_op,  
	success: function(data){
	
	//alert(data.length);
	

	
        $("#txt_no_op").val(data.no_op)
						
        $("#txt_nama_pmk").val(data.nama_pmk)
        
						
	//coba
	
	}   
    });  



});


 });
    //function PilihNop(no_op){
    //$("#no_op").val(no_op);
    //$("#dialog-objek").dialog('close');
    //}
    function PilihNop(no_op){
        $("#no_op").val(no_op);            
        $("#dialog-objek").dialog('close');						
        //coba
    }

</script>

<?php
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
    'id' => 'horizontalForm',
    'type' => 'horizontal',
    'enableAjaxValidation' => false,
        ));
?>
<fieldset>



    <?php echo $form->errorSummary($model); ?>


    <div class="control-group ">
        <label class="control-label" for="Nama Pemilik">Tahun</label>
        <div class="controls">
            <?php echo $form->textField($model, 'tahun', array('class' => 'span2', 'value' => date('Y'), 'id' => 'nama_pmk', 'maxlength' => 35)); ?>
        </div>
    </div>

    <div class="control-group ">
        <label class="control-label" for="Nama Pemilik">Jenis SK</label>
        <div class="controls">

            <?php echo $form->DropDownList($modelSetoran, 'jenis_sk', CHtml::listData($modelSk, 'kode_sk', 'nama_sk'), array('class' => 'span2', 'prompt' => 'Pilih Jenis SK')); ?>
        </div>
    </div>



    <div class="control-group ">
        <label class="control-label" for="TestForm_textField">Nomor Objek Pajak (NOP) PBB </label>
        <div class="controls">
            <input type = "text" name="no_op[]" id="no_op" class="span1" maxlength="1">
            <input type = "text" name="no_op[]" class="span1" maxlength="1">
            <input type = "text" name="no_op[]" class="span1" maxlength="1">
            <input type = "text" name="no_op[]" class="span1" maxlength="1">
            -
            <input type = "text" name="no_op[]" class="span1" maxlength="1">
            <input type = "text" name="no_op[]" class="span1" maxlength="1">
            <input type = "text" name="no_op[]" class="span1" maxlength="1">
            -

            <input type = "text" name="no_op[]" class="span1" maxlength="1">
            <input type = "text" name="no_op[]" class="span1" maxlength="1">
            <input type = "text" name="no_op[]" class="span1" maxlength="1">
            -
            <input type = "text" name="no_op[]" class="span1" maxlength="1">
            <input type = "text" name="no_op[]" class="span1" maxlength="1">
            <input type = "text" name="no_op[]" class="span1" maxlength="1">
            -
            <input type = "text" name="no_op[]" class="span1" maxlength="1">
            <input type = "text" name="no_op[]" class="span1" maxlength="1">
            <input type = "text" name="no_op[]" class="span1" maxlength="1">
            <input type = "text" name="no_op[]" class="span1" maxlength="1">
            -
            <input type = "text" name="no_op[]" class="span1" maxlength="1">

            <?php
            $this->widget('bootstrap.widgets.TbButton', array(
                'id' => 'btn_pilih_NOP',
                'type' => 'primary',
                'label' => 'F2',
            ));
            ?>
        </div>
    </div>

    <div class="control-group ">
        <label class="control-label" for="Nama Pemilik"><b>Nama Pemilik </b></label>
        <div class="controls">
            <?php echo $form->textField($model, 'nama_pmk', array('class' => 'span4','id'=>'nama_pmk', 'readonly' => true, 'id' => 'nama_pmk', 'maxlength' => 35)); ?>
        </div>
    </div>

    <div class="control-group ">
        <label class="control-label" for="Nama Pemilik"><b> Alamat Objek Pajak </b></label>
        <div class="controls">
            <?php echo $form->textField($model, 'alamat_pmk', array('class' => 'span4', 'readonly' => true, 'maxlength' => 50)); ?>

        </div>
    </div>

    <div class="control-group ">
        <label class="control-label" for="Nama Pemilik">NIK [KTP]</label>
        <div class="controls">

            <input type = "text" name="no_op[]" id="no_op" class="span1">
            <input type = "text" name="no_op[]" class="span1" >
            <input type = "text" name="no_op[]" class="span1" >
            <input type = "text" name="no_op[]" class="span1" >
            <input type = "text" name="no_op[]" class="span1" >
            -
            <input type = "text" name="no_op[]" class="span1" >
            <input type = "text" name="no_op[]" class="span1" >
            -
            <input type = "text" name="no_op[]" class="span1" >
            <input type = "text" name="no_op[]" class="span1" >
            <input type = "text" name="no_op[]" class="span1" >
            <input type = "text" name="no_op[]" class="span1" >
            <input type = "text" name="no_op[]" class="span1" >
            <input type = "text" name="no_op[]" class="span1" >
            -
            <input type = "text" name="no_op[]" class="span1" >
            <input type = "text" name="no_op[]" class="span1" >
            <input type = "text" name="no_op[]" class="span1" >
            <input type = "text" name="no_op[]" class="span1" >
        </div>
    </div>

    <div class="control-group ">
        <label class="control-label" for="Nama Pemilik"><b>Nama Wajib Pajak</b></label>
        <div class="controls">
            <?php echo $form->textField($modelWajibPajak, 'nama_wp', array('class' => 'span4', 'maxlength' => 25)); ?>
        </div>
    </div>

    <div class="control-group ">
        <label class="control-label" for="Nama Pemilik"><b> Alamat Wajib Pajak </b></label>
        <div class="controls">
            <?php echo $form->textField($modelWajibPajak, 'alamat_wp', array('class' => 'span4', 'maxlength' => 50)); ?>
        </div>
    </div>


    <div class="control-group ">
        <label class="control-label" for="Nama Pemilik">Kecamatan </label>
        <div class="controls">
            <?php echo $form->textField($modelWajibPajak, 'nama_kec', array('class' => 'span2', 'maxlength' => 25)); ?>
        </div>
    </div>

    <div class="control-group ">
        <label class="control-label" for="Nama Pemilik">Kelurahan/Desa</label>
        <div class="controls">
            <?php echo $form->textField($modelWajibPajak, 'nama_kel', array('class' => 'span2', 'maxlength' => 25)); ?>
        </div>

    </div>



    <div class="control-group ">
        <label class="control-label" for="Nama Pemilik">RT </label>
        <div class="controls">
            <?php echo $form->textField($modelWajibPajak, 'rt_wp', array('class' => 'span1', 'maxlength' => 3)); ?>
        </div>

    </div>


    <div class="control-group ">
        <label class="control-label" for="Nama Pemilik">RW </label>
        <div class="controls">
            <?php echo $form->textField($modelWajibPajak, 'rw_wp', array('class' => 'span1', 'maxlength' => 3)); ?>
        </div>

    </div>


    <div class="control-group ">
        <label class="control-label" for="Nama Pemilik">Kode Pos </label>
        <div class="controls">
            <?php echo $form->textField($modelWajibPajak, 'kode_pos', array('class' => 'span2', 'maxlength' => 25)); ?>
        </div>

    </div>

    <div class="control-group ">
        <label class="control-label" for="Nama Pemilik">Kabupaten </label>
        <div class="controls">
            <?php echo $form->textField($modelWajibPajak, 'kab_wp', array('class' => 'span2', 'maxlength' => 35)); ?>
        </div>

    </div>

    <div class="control-group ">
        <label class="control-label" for="Nama Pemilik"><b>Tanggal Bayar</b> </label>
        <div class="controls">

            <?php
            $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                'model' => $modelSetoran,
                'attribute' => 'tgl_bayar',
                'language' => 'id',
                // additional javascript options for the date picker plugin
                'options' => array(
                    'showAnim' => 'fold',
                    'dateFormat' => 'dd-mm-yy',
                    'yearRange' => 'c-50:c+20',
                ),
                'htmlOptions' => array(
                    'style' => 'height:20px;'
                ),
            ));
            ?>
        </div>

    </div>

    <div class="control-group ">
        <label class="control-label" for="Nama Pemilik"><b> No Pembayaran </b> </label>
        <div class="controls">
            <?php echo $form->textField($model, 'lokasi_op', array('class' => 'span2', 'readonly' => true, 'maxlength' => 20)); ?>
        </div>
    </div>

    <div class="control-group ">
        <label class="control-label" for="Nama Pemilik"><b>Jumlah Pajak BPHTB (Rp)</b> </label>
        <div class="controls">
            <?php echo $form->textField($model, 'lokasi_op', array('class' => 'span2', 'maxlength' => 35)); ?>
        </div>
    </div>


    <div class="form-actions">
        <?php
        $this->widget('bootstrap.widgets.TbButton', array(
            'buttonType' => 'submit',
            'type' => 'primary',
            'label' => $model->isNewRecord ? 'Simpan' : 'Save',
        ));
        ?>
        <?php
        $this->widget('bootstrap.widgets.TbButton', array(
            'buttonType' => 'reset',
            'type' => 'primary',
            'label' => $model->isNewRecord ? 'Batal' : 'reset',
        ));
        ?>
    </div>

    <?php $this->endWidget(); ?>


    <?php
    $this->beginWidget('zii.widgets.jui.CJuiDialog', array(
        'id' => 'dialog-objek',
        'theme' => 'sunny',
        'themeUrl' => Yii::app()->request->baseUrl . '/css/themes',
        'options' => array(
            'title' => 'Data Objek',
            'width' => 600,
            'min-height' => 400,
            'autoOpen' => false,
            'buttons' => array(
                'Ok' => 'js:function(){$(this).dialog("close")}',),
        ),
    ));
    ?>


    <?php
    $this->widget('bootstrap.widgets.TbGridView', array(
        'id' => 'ObjekPajak',
        'dataProvider' => $model->search(),
        'filter' => $model,
        'columns' => array(
            array(
                'name' => 'no_op',
                'value' => '$data->no_op',
            ),
            array(
                'name' => 'nama_pmk',
                'value' => '$data->nama_pmk'
            ),
            array(
                'value' => 'CHtml::submitButton("Pilih",array("no_op"=>$data->no_op,"onClick"=>"PilihNop($(this).attr(\'no_op\'))"))',
                'type' => 'raw',
            ),
        ),
    ));
    ?>


    <?php
    $this->endWidget('zii.widgets.jui.CJuiDialog');
    ?>

    <?php
    $this->beginWidget('zii.widgets.jui.CJuiDialog', array(
        'id' => 'dialog-alert',
        'theme' => 'sunny',
        'themeUrl' => Yii::app()->request->baseUrl . '/css/themes',
        'options' => array(
            'title' => 'Data Objek',
            'width' => 600,
            'min-height' => 400,
            'autoOpen' => false,
            'buttons' => array(
                'Ok' => 'js:function(){$(this).dialog("close")}',),
        ),
    ));
    ?>

    <div id='txtAlert'></div>

    <?php
    $this->endWidget('zii.widgets.jui.CJuiDialog');
    ?>
</fieldset>